package com.mudrov.internetdownloader;

import java.net.URL;
import java.util.List;

public class Reactor {

    public static void downloadAllPages(URL urlToDownload, int depth) {
        if (depth < 0)
            return;
        PageDownloader downloader = new PageReaderByLine();
        downloader.readPageFromUrl(urlToDownload);
        List<URL> listToDownload = downloader.getURLList();
        for (URL i : listToDownload)
            Reactor.downloadAllPages(i, depth - 1);
    }
}
